with open('now1.txt', 'r+', encoding="utf-8") as f:
    o =f.read()
    print(o, '===读取完成后会自动关闭文件')


import json
s = [
    {'name':'张三','age':'12',"job":'js'},
    {'name': '李四', 'age': '42', "job": 'java'},
    {'name': '王五', 'age': '22', "job": ' python'},
]

with open('now2.txt', 'w', encoding="utf-8") as f:
    # f.write(json.dumps(s, ensure_ascii=False))
    json.dump(s,f)

with open('now2.txt', 'r+', encoding="utf-8") as f:
    s = f.read()
    v = json.loads(s)
    print(type(v))
print('---'*40)
with open('now2.txt', 'r+', encoding="utf-8") as file:
    print(json.load(file))




